"use strict";
cc._RF.push(module, '7bea3FCyIZGZor4Ej50o0Bs', 'RoomLayer');
// Script/RoomLayer.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var AppDelegate_1 = require("./AppDelegate");
var AppDef_1 = require("./Core/AppDef");
var RoomLayer = /** @class */ (function (_super) {
    __extends(RoomLayer, _super);
    function RoomLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.labelTitle = null;
        _this.labelRoom = null;
        _this.menu1 = null;
        _this.menu2 = null;
        _this.userNameLayout = null;
        _this.roomNameLayout = null;
        return _this;
    }
    RoomLayer.prototype.onLoad = function () {
        this.menu1.active = true;
        this.menu2.active = false;
        this.labelTitle.string = "游 戏 大 厅";
        this.onUpdate();
    };
    RoomLayer.prototype.onUpdate = function () {
        this.userNameLayout.removeAllChildren();
        if (AppDelegate_1.default.userModel.getMyName() != "") {
            this.onCreateLabel(AppDelegate_1.default.userModel.getMyName(), this.userNameLayout);
        }
    };
    RoomLayer.prototype.onClickCreateRoom = function (event) {
        this.roomNameLayout.removeAllChildren();
        // this.onCreateLabel("房间1", this.roomNameLayout);
        this.labelTitle.string = "房  间";
        AppDelegate_1.default.gameModel.setGameState(AppDef_1.GAME_STATE.Room);
        this.menu1.active = false;
        this.menu2.active = true;
        this.labelRoom.active = false;
    };
    RoomLayer.prototype.onQuitRoom = function (event) {
        this.roomNameLayout.removeAllChildren();
        this.labelTitle.string = "游 戏 大 厅";
        AppDelegate_1.default.gameModel.setGameState(AppDef_1.GAME_STATE.Hall);
        this.menu1.active = true;
        this.menu2.active = false;
        this.labelRoom.active = true;
    };
    RoomLayer.prototype.onClickStartGame = function (event) {
        AppDelegate_1.default.gameModel.setGameState(AppDef_1.GAME_STATE.Game);
        cc.director.loadScene(AppDef_1.SCENE_TYPE.GAME);
    };
    RoomLayer.prototype.onCreateLabel = function (str, parent) {
        var node = new cc.Node('text');
        node.addComponent(cc.Label);
        node.getComponent(cc.Label).fontSize = 40;
        node.getComponent(cc.Label).string = str;
        node.color = cc.color(0x00, 0x00, 0x00);
        parent.addChild(node);
    };
    __decorate([
        property(cc.Label)
    ], RoomLayer.prototype, "labelTitle", void 0);
    __decorate([
        property(cc.Node)
    ], RoomLayer.prototype, "labelRoom", void 0);
    __decorate([
        property(cc.Node)
    ], RoomLayer.prototype, "menu1", void 0);
    __decorate([
        property(cc.Node)
    ], RoomLayer.prototype, "menu2", void 0);
    __decorate([
        property(cc.Node)
    ], RoomLayer.prototype, "userNameLayout", void 0);
    __decorate([
        property(cc.Node)
    ], RoomLayer.prototype, "roomNameLayout", void 0);
    RoomLayer = __decorate([
        ccclass
    ], RoomLayer);
    return RoomLayer;
}(cc.Component));
exports.default = RoomLayer;

cc._RF.pop();